package top.ivansong92.ms.filenas.service;

import org.springframework.stereotype.Service;
import top.ivansong92.ms.filenas.domain.FileRepository;
import top.ivansong92.ms.filenas.domain.entity.DocumentFile;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class FileService {

    @Resource
    private FileRepository fileRepository;

    public void saveFile(String originalName, String name, String contentType) {
        DocumentFile file = new DocumentFile();
        file.setContentType(contentType);
        file.setCreateTime(new Date());
        file.setName(name);
        file.setOriginalName(originalName);
        file.setStatus("up");
        file.setUpdateTime(new Date());
        fileRepository.save(file);
    }
}
